/**
 */
package BlipLanguage.impl;

import BlipLanguage.BlipApplication;
import BlipLanguage.BlipLanguagePackage;
import BlipLanguage.BlipModel;

import BlipLanguage.BlipModelAttribute;
import MocaTree.Attribute;
import MocaTree.File;
import MocaTree.Folder;
import MocaTree.MocaTreeFactory;

import MocaTree.Node;
import de.upb.tools.sdm.*;

import java.util.*;
import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Blip Application</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link BlipLanguage.impl.BlipApplicationImpl#getModels <em>Models</em>}</li>
 *   <li>{@link BlipLanguage.impl.BlipApplicationImpl#getTitle <em>Title</em>}</li>
 *   <li>{@link BlipLanguage.impl.BlipApplicationImpl#getPackageName <em>Package Name</em>}</li>
 *   <li>{@link BlipLanguage.impl.BlipApplicationImpl#getAndroidPlayLibraryPath <em>Android Play Library Path</em>}</li>
 *   <li>{@link BlipLanguage.impl.BlipApplicationImpl#getAndroidMapsApiKey <em>Android Maps Api Key</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BlipApplicationImpl extends EObjectImpl implements BlipApplication {
	/**
	 * The cached value of the '{@link #getModels() <em>Models</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getModels()
	 * @generated
	 * @ordered
	 */
	protected EList<BlipModel> models;

	/**
	 * The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTitle()
	 * @generated
	 * @ordered
	 */
	protected static final String TITLE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTitle()
	 * @generated
	 * @ordered
	 */
	protected String title = TITLE_EDEFAULT;

	/**
	 * The default value of the '{@link #getPackageName() <em>Package Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPackageName()
	 * @generated
	 * @ordered
	 */
	protected static final String PACKAGE_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getPackageName() <em>Package Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPackageName()
	 * @generated
	 * @ordered
	 */
	protected String packageName = PACKAGE_NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getAndroidPlayLibraryPath() <em>Android Play Library Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAndroidPlayLibraryPath()
	 * @generated
	 * @ordered
	 */
	protected static final String ANDROID_PLAY_LIBRARY_PATH_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getAndroidPlayLibraryPath() <em>Android Play Library Path</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAndroidPlayLibraryPath()
	 * @generated
	 * @ordered
	 */
	protected String androidPlayLibraryPath = ANDROID_PLAY_LIBRARY_PATH_EDEFAULT;

	/**
	 * The default value of the '{@link #getAndroidMapsApiKey() <em>Android Maps Api Key</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAndroidMapsApiKey()
	 * @generated
	 * @ordered
	 */
	protected static final String ANDROID_MAPS_API_KEY_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getAndroidMapsApiKey() <em>Android Maps Api Key</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAndroidMapsApiKey()
	 * @generated
	 * @ordered
	 */
	protected String androidMapsApiKey = ANDROID_MAPS_API_KEY_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected BlipApplicationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return BlipLanguagePackage.Literals.BLIP_APPLICATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<BlipModel> getModels() {
		if (models == null) {
			models = new EObjectContainmentEList<BlipModel>(BlipModel.class,
					this, BlipLanguagePackage.BLIP_APPLICATION__MODELS);
		}
		return models;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTitle(String newTitle) {
		String oldTitle = title;
		title = newTitle;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					BlipLanguagePackage.BLIP_APPLICATION__TITLE, oldTitle,
					title));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getPackageName() {
		return packageName;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPackageName(String newPackageName) {
		String oldPackageName = packageName;
		packageName = newPackageName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					BlipLanguagePackage.BLIP_APPLICATION__PACKAGE_NAME,
					oldPackageName, packageName));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getAndroidPlayLibraryPath() {
		return androidPlayLibraryPath;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAndroidPlayLibraryPath(String newAndroidPlayLibraryPath) {
		String oldAndroidPlayLibraryPath = androidPlayLibraryPath;
		androidPlayLibraryPath = newAndroidPlayLibraryPath;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(
					this,
					Notification.SET,
					BlipLanguagePackage.BLIP_APPLICATION__ANDROID_PLAY_LIBRARY_PATH,
					oldAndroidPlayLibraryPath, androidPlayLibraryPath));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getAndroidMapsApiKey() {
		return androidMapsApiKey;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAndroidMapsApiKey(String newAndroidMapsApiKey) {
		String oldAndroidMapsApiKey = androidMapsApiKey;
		androidMapsApiKey = newAndroidMapsApiKey;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					BlipLanguagePackage.BLIP_APPLICATION__ANDROID_MAPS_API_KEY,
					oldAndroidMapsApiKey, androidMapsApiKey));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case BlipLanguagePackage.BLIP_APPLICATION__MODELS:
			return ((InternalEList<?>) getModels()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case BlipLanguagePackage.BLIP_APPLICATION__MODELS:
			return getModels();
		case BlipLanguagePackage.BLIP_APPLICATION__TITLE:
			return getTitle();
		case BlipLanguagePackage.BLIP_APPLICATION__PACKAGE_NAME:
			return getPackageName();
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_PLAY_LIBRARY_PATH:
			return getAndroidPlayLibraryPath();
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_MAPS_API_KEY:
			return getAndroidMapsApiKey();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case BlipLanguagePackage.BLIP_APPLICATION__MODELS:
			getModels().clear();
			getModels().addAll((Collection<? extends BlipModel>) newValue);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__TITLE:
			setTitle((String) newValue);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__PACKAGE_NAME:
			setPackageName((String) newValue);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_PLAY_LIBRARY_PATH:
			setAndroidPlayLibraryPath((String) newValue);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_MAPS_API_KEY:
			setAndroidMapsApiKey((String) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case BlipLanguagePackage.BLIP_APPLICATION__MODELS:
			getModels().clear();
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__TITLE:
			setTitle(TITLE_EDEFAULT);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__PACKAGE_NAME:
			setPackageName(PACKAGE_NAME_EDEFAULT);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_PLAY_LIBRARY_PATH:
			setAndroidPlayLibraryPath(ANDROID_PLAY_LIBRARY_PATH_EDEFAULT);
			return;
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_MAPS_API_KEY:
			setAndroidMapsApiKey(ANDROID_MAPS_API_KEY_EDEFAULT);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case BlipLanguagePackage.BLIP_APPLICATION__MODELS:
			return models != null && !models.isEmpty();
		case BlipLanguagePackage.BLIP_APPLICATION__TITLE:
			return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT
					.equals(title);
		case BlipLanguagePackage.BLIP_APPLICATION__PACKAGE_NAME:
			return PACKAGE_NAME_EDEFAULT == null ? packageName != null
					: !PACKAGE_NAME_EDEFAULT.equals(packageName);
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_PLAY_LIBRARY_PATH:
			return ANDROID_PLAY_LIBRARY_PATH_EDEFAULT == null ? androidPlayLibraryPath != null
					: !ANDROID_PLAY_LIBRARY_PATH_EDEFAULT
							.equals(androidPlayLibraryPath);
		case BlipLanguagePackage.BLIP_APPLICATION__ANDROID_MAPS_API_KEY:
			return ANDROID_MAPS_API_KEY_EDEFAULT == null ? androidMapsApiKey != null
					: !ANDROID_MAPS_API_KEY_EDEFAULT.equals(androidMapsApiKey);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (title: ");
		result.append(title);
		result.append(", packageName: ");
		result.append(packageName);
		result.append(", androidPlayLibraryPath: ");
		result.append(androidPlayLibraryPath);
		result.append(", androidMapsApiKey: ");
		result.append(androidMapsApiKey);
		result.append(')');
		return result.toString();
	}

} //BlipApplicationImpl
